<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function CountWord ( arr ) {
            var obj = {} ; 
            for ( var i = 0 ; i < arr.length ; i ++ ) {
                if( obj[arr[i]] == undefined ) {
                    obj[arr[i]] = 1 ; 
                } else {
                    obj[arr[i]] ++ ;
                }
            }
            return obj ; 
        }
        var arr = [1,2,4,5,1,2,4,5,6,5,6,6,3,2,1];
        console.log(CountWord(arr));
    </script>
</body>
</html>